package com.zhu.transaction.mapper.imp;

import com.zhu.transaction.mapper.OrderMapper;
import com.zhu.transaction.pojo.Order;
import com.zhu.transaction.pojo.reports.OrderReports;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Zhu
 * @createtime 2021/2/14-17:07
 */
@Repository
public class OrderMapperImp implements OrderMapper {

    @Autowired
    SqlSession sqlSession;

    @Override
    public int addOneOrder(Order order) {
        return sqlSession.getMapper(OrderMapper.class).addOneOrder(order);
    }

    @Override
    public int deleteOrder(String orderId) {
        return sqlSession.getMapper(OrderMapper.class).deleteOrder(orderId);
    }

    @Override
    public int updateOrderTransactionState(String orderId, Integer newState) {
        return sqlSession.getMapper(OrderMapper.class).updateOrderTransactionState(orderId, newState);
    }

    @Override
    public int updateOrderPaymentState(String orderId, Integer newState) {
        return sqlSession.getMapper(OrderMapper.class).updateOrderPaymentState(orderId, newState);
    }

    @Override
    public List<Order> queryOrderByReleaseUserId(String userId) {
        return sqlSession.getMapper(OrderMapper.class).queryOrderByReleaseUserId(userId);
    }

    @Override
    public List<Order> queryOrderByPurchaseUserId(String userId) {
        return sqlSession.getMapper(OrderMapper.class).queryOrderByPurchaseUserId(userId);
    }

    @Override
    public List<Order> queryAllOrder() {
        return sqlSession.getMapper(OrderMapper.class).queryAllOrder();
    }

    @Override
    public List<Order> queryOrderByOrderId(String orderId) {
        return sqlSession.getMapper(OrderMapper.class).queryOrderByOrderId(orderId);
    }

    @Override
    public int updatePayStatus(Order order) {
        return sqlSession.getMapper(OrderMapper.class).updatePayStatus(order);
    }

    @Override
    public List<OrderReports> queryNewOrderReports() {
        return sqlSession.getMapper(OrderMapper.class).queryNewOrderReports();
    }

    @Override
    public List<OrderReports> queryOrderStateReports() {
        return sqlSession.getMapper(OrderMapper.class).queryOrderStateReports();
    }

    @Override
    public List<OrderReports> queryPayWayReports() {
        return sqlSession.getMapper(OrderMapper.class).queryPayWayReports();
    }
}
